package com.fanyouzhao.ehome.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: fanyouzhao
 * @Date: 16:38 2021/4/26
 */
public class JsonResult {
    private Map<String,Object> jsonMap = new HashMap<>();

    public JsonResult() {
    }
    public JsonResult(String code, String msg, Object data) {
        jsonMap.put("code",code);
        jsonMap.put("msg",msg);
        jsonMap.put("data",data);
    }
    public JsonResult(String code, String msg) {
        jsonMap.put("code",code);
        jsonMap.put("msg",msg);
    }

    public void setCode(String code) {
        jsonMap.put("code",code);
    }

    public void setMsg(String msg) {
        jsonMap.put("msg",msg);
    }

    public void setData(Object data) {
        jsonMap.put("data",data);
    }

    public void setValue(String key,Object value){
        jsonMap.put(key,value);
    }

    public Map<String,Object> getValues(){
        return jsonMap;
    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "jsonMap=" + jsonMap +
                '}';
    }
}
